﻿using System.Collections.Generic;
using System.Linq;
using Xc.DataAccess.Core.Extensions;
namespace Xc.DataAccess.Protocoals.WaterMeters.Models.Requests
{
    /// <summary>
    /// 设置表计底数
    /// </summary>
    public class SetMeterValueRequest : MeterFrameTxBase, IUnit
    {
        internal protected override DataSegment DataSegment => DataSegment.SetMeterValue;

       internal protected override FrameCommand Cmd => FrameCommand.CMD16;

        protected override void GetDataArea(List<byte> vs)
        {
            vs.Add(UnitId);
            var array= CumulativeFlow.FromDeciamlUInt32LittleEndian();
            vs.AddRange(array);
            vs.AddRange(Enumerable.Repeat<byte>(0,6));
        }
        /// <summary>
        /// 单位代码
        /// </summary>
        public byte UnitId { get; set; }
        /// <summary>
        /// 当前要设定的累积量
        /// </summary>
        public decimal CumulativeFlow { get; set; }
    }
}
